package com.supermap;


import java.lang.reflect.Array;
import java.util.*;

/**
 * @author aqua
 * @description 彩票模拟开奖
 * @date 2019年12月19 12:50
 * @email 1301584033@qq.com
 */
public class LotterySimulation {
    public static void main(String[] args) {
        int readDatas[]={2,3,6,7,8,9,12,16,19,20,22,25,26,29,33,34};
        int blueDatas[]={4,6,7,11,13};
        List<Integer> readList=new ArrayList<>();
        List<Integer> blueList=new ArrayList<>();
        for(int i=0;i<10000;i++){
            List<Integer> list=new ArrayList<>();
            getRedOneNoteLottery(readDatas,false).stream().sorted().forEach(a->{
                readList.add(a);

            });
            getBlueOneNoteLottery(blueDatas,false).forEach(a->{
                blueList.add(a);
            });
        }

        for(int a:readList){
            System.out.print(",("+a+",1)");
        }
        System.out.println();
        System.out.println();
        System.out.println();
        System.out.println();
        System.out.println();
        System.out.println();
        for(int a:blueList){
            System.out.print(",("+a+",2)");
        }
    }

    /** 
    * @descrpt:  红球生产模拟一注彩票
    * @param: [readDatas, blueDatas, bigLotto] 
    * @return: java.util.Set<java.lang.Integer> 
    * @author: chenchao
    * @date: 2019/12/19 
    * @mail chenchaoaqua@qq.com
    */ 
    public static Set<Integer> getRedOneNoteLottery(int[] readDatas,boolean bigLotto){
        Set<Integer> integerSet =new HashSet<>();
        Integer readLens=6;
        int numMax=33;
        int numMin=1;
        if(bigLotto){
            readLens=5;
            numMax=35;
        }
        if(readDatas==null){
            //系统数据源随机生成
             readDatas=new int[1000];
            for(int i=1;i<numMax+1;i++){
                readDatas[i]=i;
            }
            //自己给定数据源随机生成
            for(int i=0;i<1000;i++){
                int ranNum = (int) (Math.random()*(numMax-numMin)+numMin);
                integerSet.add(readDatas[ranNum]);
                if(integerSet.size()>=readLens){
                    break;
                }
            }
            return  integerSet;
        }else{
            numMax=readDatas.length;
            numMin=0;
            //自己给定数据源随机生成
            for(int i=0;i<1000;i++){
                int ranNum = (int) (Math.random()*(numMax-numMin)+numMin);
                integerSet.add(readDatas[ranNum]);
                if(integerSet.size()>=readLens){
                    break;
                }
            }
            return  integerSet;
        }


    }
    /**
     * @descrpt:  红球生产模拟一注彩票
     * @param: [readDatas, blueDatas, bigLotto]
     * @return: java.util.Set<java.lang.Integer>
     * @author: chenchao
     * @date: 2019/12/19
     * @mail chenchaoaqua@qq.com
     */
    public static Set<Integer> getBlueOneNoteLottery(int[] blueDatas,boolean bigLotto){
        Set<Integer> integerSet =new HashSet<>();
        Integer readLens=1;
        int numMax=16;
        int numMin=1;
        if(bigLotto){
            readLens=2;
            numMax=12;
        }
        if(blueDatas==null){
            blueDatas=new int[1000];
            //系统数据源随机生成
            for(int i=1;i<numMax+1;i++){
                blueDatas[i]=i;
            }
            //自己给定数据源随机生成
            for(int i=0;i<1000;i++){
                int ranNum = (int) (Math.random()*(numMax-numMin)+numMin);
                integerSet.add(blueDatas[ranNum]);
                if(integerSet.size()>=readLens){
                    break;
                }
            }
            return  integerSet;
        }else{
            numMax=blueDatas.length;
            numMin=0;
            //自己给定数据源随机生成
            for(int i=0;i<1000;i++){
                int ranNum = (int) (Math.random()*(numMax-numMin)+numMin);
                integerSet.add(blueDatas[ranNum]);
                if(integerSet.size()>=readLens){
                    break;
                }
            }
            return  integerSet;
        }

    }

}
